package fr.miage.orleans.aar.modele;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class EquipeTournoiId implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -4948664222539645306L;

	@ManyToOne
	private Tournoi tournoi;

	@ManyToOne
	private Equipe equipe;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((equipe == null) ? 0 : equipe.hashCode());
		result = prime * result + ((tournoi == null) ? 0 : tournoi.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EquipeTournoiId other = (EquipeTournoiId) obj;
		if (equipe == null) {
			if (other.equipe != null)
				return false;
		} else if (!equipe.equals(other.equipe))
			return false;
		if (tournoi == null) {
			if (other.tournoi != null)
				return false;
		} else if (!tournoi.equals(other.tournoi))
			return false;
		return true;
	}
	
	
}
